package com.example.demo.config;

import javax.annotation.Resource;

import com.example.demo.service.DemoService;
import com.example.demo.service.TestService;
import com.example.demo.service.TestServiceImpl;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ProxyConfig {

  @Bean
  JdkProxyHandler jdkProxyHandler(){
    return new JdkProxyHandler();
  }

  @Bean
  TestService testService(){
    // 以下方式ac.pulishEvent会报错
    //return (TestService) new JdkProxyHandler().createProxy(new TestServiceImpl());
    return new TestServiceImpl();
  }
    
}